STATUS_WAIT = 0
STATUS_UNKNOWN_ERROR = -2  # 发生了错误
STATUS_TWO_ORDER_FILLED_ERROR = -1  # 补仓单和平仓单同时被触发
STATUS_NO_POSITION = 1  # 空仓
STATUS_PENDING_OPENING_ORDER = 2  # 提交了开仓订单，等待结果
STATUS_HOLDING = 3  # 持仓中，没有订单
STATUS_PENDING_CLOSE_ORDER = 5  # 提交了平仓订单，等待结果
STATUS_REACH_MAX_MARGIN = 6  # 达到了最大保证金
STATUS_REACH_MAX_STAGE = 7  # 达到了最大补仓次数
STATUS_PENDING_CANCEL_BUY = 8  # 提交了取消加仓的订单
STATUS_PENDING_CANCEL_CLOSE = 9  # 提交了取消平仓
STATUS_WAIT_ADD_CD = 10  # 等待加仓CD
LONG = "LONG"
SHORT = "SHORT"
class Symbol:
    def __init__(self):
        #交易货币
        self.trade_symbol = ""
        #现价
        self.current_price = 0
        #上一根k线的时间
        self.last_kline_ts = 0
        #k线级别
        self.period = ""
        #breakout四要素
        self.max_breakout_length = 0
        self.threshold_rate = 0
        self.min_number_of_test = 0
        self.pivot_stage = 0
        #轴枢高点
        self.pivot_high = []
        # 轴枢低点
        self.pivot_low = []
        self.current_kline = None
        # 开仓止损比例，基数是chwidth
        self.stop_lose_ratio = 1
        # 开仓止盈比例，基数是chwidth
        self.profit_ratio = 2
        self.status = STATUS_NO_POSITION
        # 倍率
        self.leverage = None
        # 每次开仓金额
        self.position_amount = 0
        # 量
        self.quantity = 0
        # 多还是空
        self.position_side = None
        # 开仓订单号
        self.open_order_id = None
        # 止盈价位
        self.take_profit_price = 0
        # 止盈订单号
        self.take_profit_order_id = None
        # 止损价位
        self.stop_lose_price = 0
        # 止损订单号
        self.stop_lose_order_id = None

        self.price_precision = 0
        self.quantity_precision = 0
        self.tick_price_precision = 0
        # 最小开仓数量
        self.min_qty = 0


    def change_status(self, status):
        self.status = status


